package com.spring.design.responsibilitychain;

/**
 * 职责链模式  SpringMVC的 HandlerExecutionChin类用到了
 */
public class Client {

	public static void main(String[] args) {
		// 创建请求
		PurchaseRequest purchaseRequest = new PurchaseRequest(1, 32000, 1);
		
		//创建相关审批人
		DepartmentApprover departmentApprover = new DepartmentApprover("张主任");
		CollegeApprover collegeApprover = new CollegeApprover("李院长");
		ViceSchoolMasterApprover viceSchoolMasterApprover = new ViceSchoolMasterApprover("王副校");
		SchoolMasterApprover schoolMasterApprover = new SchoolMasterApprover("陈校长");
	
	
		//将需要审核的下个处理者设置好(处理人构成环形)
		departmentApprover.setApprover(collegeApprover);
		collegeApprover.setApprover(viceSchoolMasterApprover);
		viceSchoolMasterApprover.setApprover(schoolMasterApprover);
		schoolMasterApprover.setApprover(departmentApprover);

		
		departmentApprover.processRequest(purchaseRequest);
		viceSchoolMasterApprover.processRequest(purchaseRequest);
	}

}
